﻿using System.Data;
using System.Data.SqlClient;
namespace MyWeb.Data
{
	public class tblUSER_IN_ROLEDAL : SqlDataProvider
	{

		#region[tblUSER_IN_ROLE_GetbyAll]
		public DataTable tblUSER_IN_ROLE_GetByAll()
		{
			using (var cmd = new SqlCommand("sp_tblUSER_IN_ROLE_GetByAll", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				return GetTable(cmd);
			}
		}
		#endregion
		#region[tblUSER_IN_ROLE_GetbyId]
		public DataTable tblUSER_IN_ROLE_GetById(string USERID,string ROLEID)
		{
			using (var cmd = new SqlCommand("sp_tblUSER_IN_ROLE_GetById", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@USERID", USERID));
				cmd.Parameters.Add(new SqlParameter("@ROLEID", ROLEID));return GetTable(cmd);
			}
		}
		#endregion
		#region[tblUSER_IN_ROLE_GetbyTop]
		public DataTable tblUSER_IN_ROLE_GetByTop(string Top, string Where, string Order)
		{
			using (var cmd = new SqlCommand("sp_tblUSER_IN_ROLE_GetByTop", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				var da = new SqlDataAdapter(cmd);
				cmd.Parameters.Add(new SqlParameter("@Top",Top));
				cmd.Parameters.Add(new SqlParameter("@Where",Where));
				cmd.Parameters.Add(new SqlParameter("@Order",Order));
				return GetTable(cmd);
			}
		}
		#endregion
		#region[tblUSER_IN_ROLE_GetbyROLEID]
		public DataTable tblUSER_IN_ROLE_GetByROLEID(string ROLEID)
		{
			using (var cmd = new SqlCommand("sp_tblUSER_IN_ROLE_GetByROLEID", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@ROLEID", ROLEID));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblUSER_IN_ROLE_GetbyUSERID]
		public DataTable tblUSER_IN_ROLE_GetByUSERID(string USERID)
		{
			using (var cmd = new SqlCommand("sp_tblUSER_IN_ROLE_GetByUSERID", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@USERID", USERID));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblUSER_IN_ROLE_Insert]
		public void tblUSER_IN_ROLE_Insert(tblUSER_IN_ROLEInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblUSER_IN_ROLE_Insert", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@USERID", Data.USERID));
				cmd.Parameters.Add(new SqlParameter("@ROLEID", Data.ROLEID));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
		#region[tblUSER_IN_ROLE_Update]
		public void tblUSER_IN_ROLE_Update(tblUSER_IN_ROLEInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblUSER_IN_ROLE_Update", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@USERID", Data.USERID));
				cmd.Parameters.Add(new SqlParameter("@ROLEID", Data.ROLEID));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
		#region[tblUSER_IN_ROLE_Delete]
		public void tblUSER_IN_ROLE_Delete(string USERID,string ROLEID)
		{
			using (var cmd = new SqlCommand("sp_tblUSER_IN_ROLE_Delete", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@USERID",USERID));
				cmd.Parameters.Add(new SqlParameter("@ROLEID",ROLEID));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
	}
}